﻿using Autofac;

namespace Super.Admin.Modules
{
    public class ViewModule : Module
    {
        /// <summary>
        /// 注册所有的 窗体 类
        /// </summary>
        /// <param name="builder"></param>
        protected override void Load(ContainerBuilder builder)
        {
            // 注册窗体
            builder.RegisterAssemblyTypes(System.Reflection.Assembly.GetExecutingAssembly())
                .Where(t => t.Name.StartsWith("Frm") && typeof(Form).IsAssignableFrom(t))
                .AsSelf()
                .InstancePerDependency();

            // 注册View 界面
            builder.RegisterAssemblyTypes(System.Reflection.Assembly.GetExecutingAssembly())
                .Where(t => t.Name.EndsWith("View") && typeof(UserControl).IsAssignableFrom(t))
                .AsSelf()
                .InstancePerDependency();
        }
    }
}
 